import Vue from "vue"
import Vuex from 'vuex'
Vue.use(Vuex)

// 利用webpack的require.context查找文件，快速导入模块
const context = require.context('./models',false,/\.js$/)

const map = {}
for (let key of context.keys()) {
	const keyArr = key.split('/')
	keyArr.shift() // 移除.
	map[keyArr.join('.').replace(/\.js$/g, '')] = context(key).default;
}
console.log(map);
export default new Vuex.Store({
	modules:{
		...map
	}
})